package com.ai.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ai.web.service.WxRoleMenuService;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.WxRoleMenu;

/**
 * 前端角色菜单关系
* @ClassName: wxroleMenuController 
* @Description: TODO 
* @author:  
* @date: 2014年3月24日
*
 */
@Controller
@RequestMapping("/wxRoleMenu")
public class WxRoleMenuController extends BaseController {
        
    @Autowired
    private WxRoleMenuService wxRoleMenuService;
    
    
    @ResponseBody
	@RequestMapping(value = "/selectMenus/{roleId}", method = RequestMethod.GET)
	public List<WxRoleMenu> findMenuListByRoleId(
			@PathVariable("roleId") int roleId) throws Exception {
		return wxRoleMenuService.findSelectedMenuList(roleId);
	}
    
    
    @RequestMapping(value = "/asignMenu/{roleId}", produces = "application/json")
    @ResponseBody
    public ResultModel asignMenu(@PathVariable("roleId") int roleId, String menuIds) throws Exception {
    	 return wxRoleMenuService.asignMenu(roleId, menuIds);
    }
    
}
